﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="UsefulTips_All.aspx.vb" Inherits="Travelling_Alone.UsefulTips_All" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<style type="text/css">
    .style1
    {
        font-size: x-large;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<p class="style1">
        Select &quot;Read Full&quot; to read a Useful Tip in detail.</p>
<p class="style1">
    <asp:GridView ID="GridView1" Width="600px" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="ID" DataSourceID="SqlDataSource1" style="font-size: medium" 
        BackColor="#66C266" BorderColor="Tan" BorderWidth="1px" 
        CellPadding="2" ForeColor="Black" GridLines="None" HorizontalAlign="Left">
        <AlternatingRowStyle BackColor="#85ce85" />
        <Columns>
            <asp:BoundField DataField="the_author" HeaderText="Traveller" 
                SortExpression="the_author" />
            <asp:BoundField DataField="the_title" HeaderText="Title" 
                SortExpression="the_title" />
            <asp:BoundField DataField="avgrating" ItemStyle-ForeColor="#FFCC00" ItemStyle-HorizontalAlign = "Center" 
            HeaderText="Average Rating out of 5" DataFormatString="{0:0.0}" />
            <asp:HyperLinkField Text="Read Full &gt;&gt;&gt;" 
                DataNavigateUrlFields="ID" ControlStyle-BackColor="White" 
                DataNavigateUrlFormatString="UsefulTip_Detail.aspx?ID={0}" >
<ControlStyle BackColor="White"></ControlStyle>
            </asp:HyperLinkField>
        </Columns>
        <FooterStyle BackColor="Tan" />
        <HeaderStyle BackColor="#006600" ForeColor="White" Font-Bold="True" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
            HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <SortedAscendingCellStyle BackColor="#FAFAE7" />
        <SortedAscendingHeaderStyle BackColor="#DAC09E" />
        <SortedDescendingCellStyle BackColor="#E1DB9C" />
        <SortedDescendingHeaderStyle BackColor="#C2A47B" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TravellingAloneConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:TravellingAloneConnectionString.ProviderName %>" 
        SelectCommand="SELECT useful_tips.ID, useful_tips.the_title, useful_tips.the_author, AVG (useful_tips_ratings.rating_value) AS avgrating 
        FROM useful_tips INNER JOIN useful_tips_ratings ON useful_tips.ID = useful_tips_ratings.useful_tip_fkid GROUP BY useful_tips.ID, useful_tips.the_title,
        useful_tips.the_author"></asp:SqlDataSource>
</p>

</asp:Content>
